<?php
namespace BP\Sys;

require_once("BP/En/Map.php");
class FrmRpt extends EntityNoName {
	public $HisGEDtls_temp;	// GEDtls
	public $_IsReadonly;	// int
	public $IsUse;	// boolean
	private function __init() { // default class members
		$this->HisGEDtls_temp = NULL;
		$this->_IsReadonly = 2;
		$this->IsUse =  FALSE ;
	}
	public function getMapFrames () 
	{
		$tempVar = $this->GetRefObject("MapFrames");
		$obj = ( ($tempVar instanceof MapFrames) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapFrames::constructor__String($this->getNo());
			$this->SetRefObject("MapFrames", $obj);
		}
		return $obj;
	}
	public function getMapExts () 
	{
		$tempVar = $this->GetRefObject("MapExts");
		$obj = ( ($tempVar instanceof MapExts) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapExts::constructor__String($this->getNo());
			$this->SetRefObject("MapExts", $obj);
		}
		return $obj;
	}
	public function getFrmEvents () 
	{
		$tempVar = $this->GetRefObject("FrmEvents");
		$obj = ( ($tempVar instanceof FrmEvents) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEvents::constructor__I($this->getNo());
			$this->SetRefObject("FrmEvents", $obj);
		}
		return $obj;
	}
	public function getFrmRpts () 
	{
		$tempVar = $this->GetRefObject("FrmRpts");
		$obj = ( ($tempVar instanceof FrmRpts) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmRpts::constructor__String($this->getNo());
			$this->SetRefObject("FrmRpts", $obj);
		}
		return $obj;
	}
	public function getFrmLinks () 
	{
		$tempVar = $this->GetRefObject("FrmLinks");
		$obj = ( ($tempVar instanceof FrmLinks) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLinks::constructor__String($this->getNo());
			$this->SetRefObject("FrmLinks", $obj);
		}
		return $obj;
	}
	public function getFrmBtns () 
	{
		$tempVar = $this->GetRefObject("FrmLinks");
		$obj = ( ($tempVar instanceof FrmBtns) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmBtns::constructor__String($this->getNo());
			$this->SetRefObject("FrmBtns", $obj);
		}
		return $obj;
	}
	public function getFrmEles () 
	{
		$tempVar = $this->GetRefObject("FrmEles");
		$obj = ( ($tempVar instanceof FrmEles) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEles::constructor__String($this->getNo());
			$this->SetRefObject("FrmEles", $obj);
		}
		return $obj;
	}
	public function getFrmLines () 
	{
		$tempVar = $this->GetRefObject("FrmLines");
		$obj = ( ($tempVar instanceof FrmLines) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLines::constructor__String($this->getNo());
			$this->SetRefObject("FrmLines", $obj);
		}
		return $obj;
	}
	public function getFrmLabs () 
	{
		$tempVar = $this->GetRefObject("FrmLabs");
		$obj = ( ($tempVar instanceof FrmLabs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLabs::constructor__String($this->getNo());
			$this->SetRefObject("FrmLabs", $obj);
		}
		return $obj;
	}
	public function getFrmImgs () 
	{
		$tempVar = $this->GetRefObject("FrmLabs");
		$obj = ( ($tempVar instanceof FrmImgs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgs::constructor__String($this->getNo());
			$this->SetRefObject("FrmLabs", $obj);
		}
		return $obj;
	}
	public function getFrmAttachments () 
	{
		$tempVar = $this->GetRefObject("FrmAttachments");
		$obj = ( ($tempVar instanceof FrmAttachments) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmAttachments::constructor__String($this->getNo());
			$this->SetRefObject("FrmAttachments", $obj);
		}
		return $obj;
	}
	public function getFrmImgAths () 
	{
		$tempVar = $this->GetRefObject("FrmImgAths");
		$obj = ( ($tempVar instanceof FrmImgAths) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgAths::constructor__String($this->getNo());
			$this->SetRefObject("FrmImgAths", $obj);
		}
		return $obj;
	}
	public function getFrmRBs () 
	{
		$tempVar = $this->GetRefObject("FrmRBs");
		$obj = ( ($tempVar instanceof FrmRBs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmRBs::constructor__String($this->getNo());
			$this->SetRefObject("FrmRBs", $obj);
		}
		return $obj;
	}
	public function getMapAttrs () 
	{
		$tempVar = $this->GetRefObject("MapAttrs");
		$obj = ( ($tempVar instanceof MapAttrs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapAttrs::constructor__String($this->getNo());
			$this->SetRefObject("MapAttrs", $obj);
		}
		return $obj;
	}
	public function getSQLOfRow () 
	{
		return $this->GetValStringByKey(FrmRptAttr::$SQLOfRow);
	}
	public function setSQLOfRow ($value) // [String value]
	{
		$this->SetValByKey(FrmRptAttr::$SQLOfRow, $value);
	}
	public function getSQLOfColumn () 
	{
		return $this->GetValStringByKey(FrmRptAttr::$SQLOfColumn);
	}
	public function setSQLOfColumn ($value) // [String value]
	{
		$this->SetValByKey(FrmRptAttr::$SQLOfColumn, $value);
	}
	public function getHisEditModel () 
	{
		return EditModel->forValue($this->GetValIntByKey(FrmRptAttr::$EditModel));
	}
	public function setHisEditModel ($value) // [EditModel value]
	{
		$this->SetValByKey(FrmRptAttr::$EditModel, $value->getValue());
	}
	public function getHisWhenOverSize () 
	{
		return WhenOverSize->forValue($this->GetValIntByKey(FrmRptAttr::$WhenOverSize));
	}
	public function setHisWhenOverSize ($value) // [WhenOverSize value]
	{
		$this->SetValByKey(FrmRptAttr::$WhenOverSize, $value->getValue());
	}
	public function getIsExp () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsExp);
	}
	public function setIsExp ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsExp, $value);
	}
	public function getIsImp () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsImp);
	}
	public function setIsImp ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsImp, $value);
	}
	public function getIsShowSum () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsShowSum);
	}
	public function setIsShowSum ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsShowSum, $value);
	}
	public function getIsShowIdx () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsShowIdx);
	}
	public function setIsShowIdx ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsShowIdx, $value);
	}
	public function getIsReadonly_del () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsReadonly);
	}
	public function setIsReadonly_del ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsReadonly, $value);
	}
	public function getIsShowTitle () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsShowTitle);
	}
	public function setIsShowTitle ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsShowTitle, $value);
	}
	public function getIsHLDtl () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsHLDtl);
	}
	public function setIsHLDtl ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsHLDtl, $value);
	}
	public function getIsReadonly () 
	{
		if (($this->_IsReadonly != 2))
		{
			if (($this->_IsReadonly == 1))
			{
				return  TRUE ;
			}
			else
			{
				return  FALSE ;
			}
		}
		if ((($this->getIsDelete() || $this->getIsInsert()) || $this->getIsUpdate()))
		{
			$this->_IsReadonly = 0;
			return  FALSE ;
		}
		$this->_IsReadonly = 1;
		return  TRUE ;
	}
	public function getIsDelete () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsDelete);
	}
	public function setIsDelete ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsDelete, $value);
	}
	public function getIsInsert () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsInsert);
	}
	public function setIsInsert ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsInsert, $value);
	}
	public function getIsView () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsView);
	}
	public function setIsView ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsView, $value);
	}
	public function getIsUpdate () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsUpdate);
	}
	public function setIsUpdate ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsUpdate, $value);
	}
	public function getIsEnableAthM () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsEnableAthM);
	}
	public function setIsEnableAthM ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsEnableAthM, $value);
	}
	public function getIsEnableGroupField () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsEnableGroupField);
	}
	public function setIsEnableGroupField ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsEnableGroupField, $value);
	}
	public function getIsEnablePass () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsEnablePass);
	}
	public function setIsEnablePass ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsEnablePass, $value);
	}
	public function getIsCopyNDData () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsCopyNDData);
	}
	public function setIsCopyNDData ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsCopyNDData, $value);
	}
	public function getIsEnableM2M () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsEnableM2M);
	}
	public function setIsEnableM2M ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsEnableM2M, $value);
	}
	public function getIsEnableM2MM () 
	{
		return $this->GetValBooleanByKey(FrmRptAttr::$IsEnableM2MM);
	}
	public function setIsEnableM2MM ($value) // [boolean value]
	{
		$this->SetValByKey(FrmRptAttr::$IsEnableM2MM, $value);
	}
	public function getDtlOpenType () 
	{
		return DtlOpenType->forValue($this->GetValIntByKey(FrmRptAttr::$DtlOpenType));
	}
	public function setDtlOpenType ($value) // [DtlOpenType value]
	{
		$this->SetValByKey(FrmRptAttr::$DtlOpenType, $value->getValue());
	}
	public function getGroupField () 
	{
		return $this->GetValStrByKey(FrmRptAttr::$GroupField);
	}
	public function setGroupField ($value) // [String value]
	{
		$this->SetValByKey(FrmRptAttr::$GroupField, $value);
	}
	public function getFK_MapData () 
	{
		return $this->GetValStrByKey(FrmRptAttr::$FK_MapData);
	}
	public function setFK_MapData ($value) // [String value]
	{
		$this->SetValByKey(FrmRptAttr::$FK_MapData, $value);
	}
	public function getRowsOfList () 
	{
		return $this->GetValIntByKey(FrmRptAttr::$RowsOfList);
	}
	public function setRowsOfList ($value) // [int value]
	{
		$this->SetValByKey(FrmRptAttr::$RowsOfList, $value);
	}
	public function getRowIdx () 
	{
		return $this->GetValIntByKey(FrmRptAttr::$RowIdx);
	}
	public function setRowIdx ($value) // [int value]
	{
		$this->SetValByKey(FrmRptAttr::$RowIdx, $value);
	}
	public function getGroupID () 
	{
		return $this->GetValIntByKey(FrmRptAttr::$GroupID);
	}
	public function setGroupID ($value) // [int value]
	{
		$this->SetValByKey(FrmRptAttr::$GroupID, $value);
	}
	public function getPTable () 
	{
		$s = $this->GetValStrByKey(FrmRptAttr::$PTable);
		if ((($s . NULL) . $s->equals("")))
		{
			$s = $this->getNo();
			if ($s->substring(0, 1)->equals("0"))
			{
				return ("T" . $this->getNo());
			}
			else
			{
				return $s;
			}
		}
		else
		{
			if ($s->substring(0, 1)->equals("0"))
			{
				return ("T" . $this->getNo());
			}
			else
			{
				return $s;
			}
		}
	}
	public function setPTable ($value) // [String value]
	{
		$this->SetValByKey(FrmRptAttr::$PTable, $value);
	}
	public function getMTR () 
	{
		$s = $this->GetValStrByKey(FrmRptAttr::$MTR);
		$s = $s->replace("�?", "<");
		$s = $s->replace("�?", ">");
		$s = $s->replace("�?", "'");
		return $s;
	}
	public function setMTR ($value) // [String value]
	{
		$s = $value;
		$s = $s->replace("<", "�?");
		$s = $s->replace(">", "�?");
		$s = $s->replace("'", "�?");
		$this->SetValByKey(FrmRptAttr::$MTR, $value);
	}
	public function GenerMap () 
	{
		$isdebug = SystemConfig::getIsDebug();
		if (($isdebug ==  FALSE ))
		{
			$m =Cash->GetMap($this->getNo());
			if (($m != NULL))
			{
				return $m;
			}
		}
		$mapAttrs = $this->getMapAttrs();
		$map = new Map($this->getPTable(), $this->getName());
		$map->Java_SetEnType($EnType->App);
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$attrs = new Attrs();
		foreach ($mapAttrs->ToJavaList() as $mapAttr) 		{
			$map->AddAttr($mapAttr->getHisAttr());
		}
		Cash->SetMap($this->getNo(), $map);
		return $map;
	}
	public function getHisGEDtl () 
	{
		$dtl = GEDtl::constructor__String($this->getNo());
		return $dtl;
	}
	public function GenerGEMainEntity ($mainPK) // [String mainPK]
	{
		$en = GEEntity::constructor__String_Object($this->getFK_MapData(), $mainPK);
		return $en;
	}
	public static function constructor__ () 
	{
		$me = new self();
		$me->__init();
		return $me;
	}
	public static function constructor__String ($mypk) // [String mypk]
	{
		$me = new self();
		$me->__init();
		$me->setNo($mypk);
		$me->_IsReadonly = 2;
		$me->Retrieve();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_FrmRpt", "纬度报表");
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetEnType($EnType->Sys);
		$map->IndexField = FrmImgAthDBAttr::$FK_MapData;
		$map->AddTBStringPK(FrmRptAttr::$No, NULL, "编号",  TRUE ,  FALSE , 1, 20, 20);
		$map->AddTBString(FrmRptAttr::$Name, NULL, "描述",  TRUE ,  FALSE , 1, 50, 20);
		$map->AddTBString(FrmRptAttr::$FK_MapData, NULL, "主表",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddTBString(FrmRptAttr::$PTable, NULL, "物理�?",  TRUE ,  FALSE , 0, 30, 20);
		$map->AddTBString(FrmRptAttr::$SQLOfColumn, NULL, "列的数据�?",  TRUE ,  FALSE , 0, 300, 20);
		$map->AddTBString(FrmRptAttr::$SQLOfRow, NULL, "行数据源",  TRUE ,  FALSE , 0, 300, 20);
		$map->AddTBInt(FrmRptAttr::$RowIdx, 99, "位置",  FALSE ,  FALSE );
		$map->AddTBInt(FrmRptAttr::$GroupID, 0, "GroupID",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsShowSum,  TRUE , "IsShowSum",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsShowIdx,  TRUE , "IsShowIdx",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsCopyNDData,  TRUE , "IsCopyNDData",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsHLDtl,  FALSE , "是否是合流汇�?",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsReadonly,  FALSE , "IsReadonly",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsShowTitle,  TRUE , "IsShowTitle",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsView,  TRUE , "是否可见",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsExp,  TRUE , "IsExp",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsImp,  TRUE , "IsImp",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsInsert,  TRUE , "IsInsert",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsDelete,  TRUE , "IsDelete",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsUpdate,  TRUE , "IsUpdate",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsEnablePass,  FALSE , "是否启用通过审核功能?",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsEnableAthM,  FALSE , "是否启用多附�?",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsEnableM2M,  FALSE , "是否启用M2M",  FALSE ,  FALSE );
		$map->AddBoolean(FrmRptAttr::$IsEnableM2MM,  FALSE , "是否启用M2M",  FALSE ,  FALSE );
		$map->AddDDLSysEnum(FrmRptAttr::$WhenOverSize, 0, "WhenOverSize",  TRUE ,  TRUE , FrmRptAttr::$WhenOverSize, "@0=不处理@1=向下顺增行@2=次页显示");
		$map->AddDDLSysEnum(FrmRptAttr::$DtlOpenType, 1, "数据�?放类�?",  TRUE ,  TRUE , FrmRptAttr::$DtlOpenType, "@0=操作员@1=工作ID@2=流程ID");
		$map->AddDDLSysEnum(FrmRptAttr::$EditModel, 0, "显示格式",  TRUE ,  TRUE , FrmRptAttr::$EditModel, "@0=表格@1=卡片");
		$map->AddTBFloat(FrmRptAttr::$X, 5, "X",  TRUE ,  FALSE );
		$map->AddTBFloat(FrmRptAttr::$Y, 5, "Y",  FALSE ,  FALSE );
		$map->AddTBFloat(FrmRptAttr::$H, 150, "H",  TRUE ,  FALSE );
		$map->AddTBFloat(FrmRptAttr::$W, 200, "W",  FALSE ,  FALSE );
		$map->AddTBFloat(FrmRptAttr::$FrmW, 900, "FrmW",  TRUE ,  TRUE );
		$map->AddTBFloat(FrmRptAttr::$FrmH, 1200, "FrmH",  TRUE ,  TRUE );
		$map->AddTBString(FrmRptAttr::$MTR, NULL, "多表头列",  TRUE ,  FALSE , 0, 3000, 20);
		$map->AddTBString(FrmRptAttr::$GUID, NULL, "GUID",  TRUE ,  FALSE , 0, 128, 20);
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	public function getX () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$X);
	}
	public function getY () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$Y);
	}
	public function getW () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$W);
	}
	public function getH () 
	{
		return $this->GetValFloatByKey(FrmImgAttr::$H);
	}
	public function getFrmW () 
	{
		return $this->GetValFloatByKey(FrmRptAttr::$FrmW);
	}
	public function getFrmH () 
	{
		return $this->GetValFloatByKey(FrmRptAttr::$FrmH);
	}
	public function GetCountByFK_I ($workID) // [int workID]
	{
		returnDBAccess->RunSQLReturnValInt(((("select COUNT(OID) from " . $this->getPTable()) . " WHERE WorkID=") . $workID));
	}
	public function GetCountByFK_String_String ($field, $val) // [String field, String val]
	{
		returnDBAccess->RunSQLReturnValInt((((((("select COUNT(OID) from " . $this->getPTable()) . " WHERE ") . $field) . "='") . $val) . "'"));
	}
	public function GetCountByFK_String_L ($field, $val) // [String field, long val]
	{
		returnDBAccess->RunSQLReturnValInt(((((("select COUNT(OID) from " . $this->getPTable()) . " WHERE ") . $field) . "=") . $val));
	}
	public function GetCountByFK_String_L_String_String ($f1, $val1, $f2, $val2) // [String f1, long val1, String f2, String val2]
	{
		returnDBAccess->RunSQLReturnValInt((((((((((("SELECT COUNT(OID) from " . $this->getPTable()) . " WHERE ") . $f1) . "=") . $val1) . " AND ") . $f2) . "='") . $val2) . "'"));
	}
	public function IntMapAttrs () 
	{
		$md = MapData::constructor__();
		$md->setNo($this->getNo());
		if (($md->RetrieveFromDBSources() == 0))
		{
			$md->setName($this->getName());
			$md->Insert();
		}
		$attrs = MapAttrs::constructor__String($this->getNo());
		$attr = MapAttr::constructor__();
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "OID") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("OID");
			$attr->setName("主键");
			$attr->setMyDataType(DataType->AppInt);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("0");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "RefPK") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("RefPK");
			$attr->setName("关联ID");
			$attr->setMyDataType(DataType->AppString);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("0");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "FID") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("FID");
			$attr->setName("FID");
			$attr->setMyDataType(DataType->AppInt);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("0");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "RDT") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->UnDel);
			$attr->setKeyOfEn("RDT");
			$attr->setName("记录时间");
			$attr->setMyDataType(DataType->AppDateTime);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setTag("1");
			$attr->Insert();
		}
		if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "Rec") ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($EditType->Readonly);
			$attr->setKeyOfEn("Rec");
			$attr->setName("记录�?");
			$attr->setMyDataType(DataType->AppString);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setMaxLen(20);
			$attr->setMinLen(0);
			$attr->setDefVal("@WebUser.getNo()");
			$attr->setTag("@WebUser.getNo()");
			$attr->Insert();
		}
	}
	protected function InitExtMembers () 
	{
		if ($this->getIsEnableAthM())
		{
			$athDesc = FrmAttachment::constructor__();
			$athDesc->setMyPK(($this->getNo() . "_AthM"));
			if (($athDesc->RetrieveFromDBSources() == 0))
			{
				$athDesc->setFK_MapData($this->getNo());
				$athDesc->setNoOfObj("AthM");
				$athDesc->setName($this->getName());
				$athDesc->Insert();
			}
		}
	}
	protected function beforeInsert () 
	{
		$this->InitExtMembers();
		return parent->beforeInsert();
	}
	protected function beforeUpdateInsertAction () 
	{
		if ($this->getIsEnablePass())
		{
			$attrs = MapAttrs::constructor__String($this->getNo());
			if (($attrs->Contains(MapAttrAttr::$KeyOfEn, "IsPass") ==  FALSE ))
			{
				throw new \RuntimeException((("您启用了从表�?(" . $this->getName()) . ")条数据审核�?�项，但是该从表里没IsPass字段，请参�?�帮助文档�??"));
			}
		}
		return parent->beforeUpdateInsertAction();
	}
	protected function beforeUpdate () 
	{
		$attrs = MapAttrs::constructor__String($this->getNo());
		$isHaveEnable =  FALSE ;
		foreach ($attrs->ToJavaList() as $attr) 		{
			if (($attr->getUIIsEnable() && ($attr->getUIContralType() == $UIContralType->TB)))
			{
				$isHaveEnable =  TRUE ;
			}
		}
		$this->InitExtMembers();
		return parent->beforeUpdate();
	}
	protected function beforeDelete () 
	{
		$sql = "";
		$sql += (("@DELETE FROM Sys_FrmLine WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmLab WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmLink WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmImg WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmImgAth WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmRB WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_FrmAttachment WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_MapFrame WHERE FK_MapData='" . $this->getNo()) . "'");
		if (($this->getNo()->contains("BP.") ==  FALSE ))
		{
			$sql += (("@DELETE FROM Sys_MapExt WHERE FK_MapData='" . $this->getNo()) . "'");
		}
		$sql += (("@DELETE FROM Sys_MapAttr WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_MapData WHERE No='" . $this->getNo()) . "'");
		$sql += (("@DELETE FROM Sys_GroupField WHERE FrmID='" . $this->getNo()) . "'");
		DBAccess->RunSQLs($sql);
		try 
		{
			if ((DBAccess->RunSQLReturnValInt((("SELECT COUNT(*) as Num FROM " . $this->getPTable()) . " WHERE 1=1 ")) == 0))
			{
				DBAccess::RunSQL(("DROP TABLE " . $this->getPTable()));
			}
		}
		catch (\Exception $e)
		{ /* empty */ }
		return parent->beforeDelete();
	}
}
?>
